package com.personal.sfe.security;

import com.personal.sfe.user.bo.UserBO;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * @author: 梁奔
 * @date: 2025/11/05
 */

public class CustomUserDetails implements UserDetails {

    @Getter
    private final UserBO userBO;
    @Getter
    private final Collection<? extends GrantedAuthority> authorities;

    public CustomUserDetails(UserBO userBO, Collection<? extends GrantedAuthority> authorities) {
        this.userBO = userBO;
        this.authorities = authorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authorities;
    }

    @Override
    public String getPassword() {
        return userBO.getPassword();
    }

    @Override
    public String getUsername() {
        return userBO.getUsername();
    }

    @Override
    public boolean isEnabled() {
        return userBO.getEnabled();
    }


}
